package service;

import dao.BookCategoryDao;
import domin.BookCategory;
import util.Condition;
import util.JdbcHelper;
import util.Pagination;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;

public class BookCategoryService {
    private static BookCategoryDao bookCategoryDao= BookCategoryDao.getInstance();
    private static BookCategoryService bookCategoryService=new BookCategoryService();
    public static BookCategoryService getInstance(){
        return bookCategoryService;
    }
    public BookCategory find(Integer id) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        BookCategory bookCategory = bookCategoryDao.find(connection,id);
        return bookCategory;
    }
    public Collection<BookCategory> findAll(Collection<Condition> condition, Pagination pagination) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        Collection<BookCategory> degrees = bookCategoryDao.findAll(connection,condition,pagination);
        JdbcHelper.close(connection);
        return degrees;
    }
}
